package com.example.demo.demos.web.Services.impl;

import com.example.demo.demos.web.Services.DataHandleService;
import com.example.demo.demos.web.mapper.CommonDataMapper;
import com.example.demo.demos.web.mapper.ReportDataMapper;
import com.example.demo.demos.web.mapper.SystemDataMapper;
import com.example.demo.demos.web.po.CommonData;
import com.example.demo.demos.web.po.ReportData;
import com.example.demo.demos.web.po.SystemData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @BelongsProject: demo1
 * @BelongsPackage: com.example.demo.demos.web.Services.impl
 * @Author: Hu1er
 * @CreateTime: 2023-07-03  09:36
 * @Description: TODO
 * @Version: 1.0
 */

@Service
public class DataHandleServiceImpl implements DataHandleService {
    @Autowired
    CommonDataMapper commonDataMapper;
    @Autowired
    SystemDataMapper systemDataMapper;
    @Autowired
    ReportDataMapper reportDataMapper;


    @Override
    public int insertCommonData(CommonData commonData) {
        if (commonData != null) {
            int lineNum =  commonDataMapper.insert(commonData);
            return lineNum;
        }else {
            return 0;
        }
    }

    @Override
    public int insertSystemData(SystemData systemData) {
        if (systemData != null) {
            int lineNum =  systemDataMapper.insert(systemData);
            return lineNum;
        }else {
            return 0;
        }

    }

    @Override
    public int insertReportdata(ReportData reportData) {
        if (reportData != null) {
            int lineNum =  reportDataMapper.insert(reportData);
            return lineNum;
        }else {
            return 0;
        }
    }

    @Override
    public List<String> selectSystemNameByCustomName(String customName) {
        return systemDataMapper.selectSystemNameByCustomName(customName);
    }
    @Override
    public List<ReportData> selectVulninfoByCustomName(String customName){
        return reportDataMapper.selectVulninfoByCustomName(customName);
    }
    @Override
    public List<String> showSystemNameByCustomName(String customName){
        return commonDataMapper.selectSystemNameByCustomName(customName);
    }

}
